<template>
  <el-dialog title="修改品牌案例分类" :visible="visible" @close="handleClose">
  
    </el-alert>
    <el-form label-width="90px">
      <el-form-item label="名称" :rules="[ { required: true, message: '名称不能为空'}]">
        <el-input v-model="courseName"></el-input>
      </el-form-item>
      <el-form-item label="标题" prop="seoTitle">
        <el-input v-model="form.seoTitle" type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="描述" prop="seoDesc">
        <el-input v-model="form.seoDesc" type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="关键字" prop="seoKeyword">
        <el-input v-model="form.seoKeyword" type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="排序">
              <div class="help-tip el-iconhelp_tip element-icons" style="left: -62px;">
                <p class="help-tip-content">页面中可以通过“排序”进行升序排序。</p>
              </div>
              <el-input-number v-model="sort" :min="0" :controls="false"></el-input-number>
            </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="onSubmit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    props: ['visible', 'data', 'type'],
    data () {
      return {
        form: {
          courseName: ''
        },
        courseName: '',
        sort: ''
      }
    },
    created(){
      this.form = this.data;
      this.courseName = this.data.courseName
      this.sort = this.data.sort
    },
    methods: {
      handleClose() {
        this.form = {}
        this.$emit('update:visible', false)
      },
      onSubmit() {
        const params = {
          ...this.form,
           doucmentType: 2,
           courseName: this.courseName,
           sort: this.sort
        }
        this.$api.courseType.update(params).then(res => {
          if(res.success) {
            this.$message.success('修改成功')
            this.$emit('save', true)
          }
        })
      }
    }
  }
</script>
